package com.CodeCraft.bean;

import com.CodeCraft.utils.PropertiesUtils;

/**
 * <p>
 * 描述:
 * </p>
 *
 * @author Dorain
 * @version 1.0.0
 * @since 2025/3/30
 */
public class Constants {
    public static final String[] SQL_DATE_TIME_TYPES = new String[]{"datetime", "timestamp"};
    public static final String[] SQL_DATE_TYPES = new String[]{"date"};
    public static final String[] SQL_DECIMAL_TYPES = new String[]{"decimal", "double", "float"};
    public static final String[] SQL_STRING_TYPES = new String[]{"varchar", "char", "text", "longtext", "tinytext", "mediumtext", "set"};
    public static final String[] SQL_INTEGER_TYPES = new String[]{"int", "tinyint"};
    public static final String[] SQL_LONG_TYPES = new String[]{"bigint"};
    public static String AUTHOR_NAME;
    public static boolean IGNORE_TABLE_PREFIX;
    public static String SUFFIX_BEAN_QUERY;
    public static String SUFFIX_BEAN_QUERY_FUZZY;
    public static String SUFFIX_BEAN_QUERY_TIME_START;
    public static String SUFFIX_BEAN_QUERY_TIME_END;
    public static String SUFFIX_MAPPERS;

    //需要忽略的属性
    public static String IGNORE_BEAN_ToJSON_FIELD;
    public static String IGNORE_BEAN_ToJSON_EXPRESSION;
    public static String IGNORE_BEAN_ToJSON_CLASS;
    //日期格式序列化
    public static String BEAN_DATE_FORMAT_EXPRESSION;
    public static String BEAN_DATE_FORMAT_CLASS;
    //日期格式反序列化
    public static String BEAN_DATE_UnFORMAT_EXPRESSION;
    public static String BEAN_DATE_UnFORMAT_CLASS;
    public static String PACKAGE_BASE;
    public static String PACKAGE_PO;
    public static String PACKAGE_QUERY;
    public static String PACKAGE_MAPPERS;
    public static String PACKAGE_UTILS;
    public static String PACKAGE_ENUMS;
    public static String PATH_BASE;
    public static String PATH_PO;
    public static String PATH_MAPPERS;
    public static String PATH_UTILS;
    public static String PATH_ENUMS;
    public static String PATH_QUERY;


    private static String PATH_JAVA = "java";
    private static String PATH_RESOURCES = "resources";

    static {
        //获取配置作者名称
        AUTHOR_NAME = PropertiesUtils.getProperty("author.name");

        //需要忽略的属性
        IGNORE_BEAN_ToJSON_FIELD = PropertiesUtils.getProperty("ignore.bean.toJson.field");
        IGNORE_BEAN_ToJSON_EXPRESSION = PropertiesUtils.getProperty("ignore.bean.toJson.expression");
        IGNORE_BEAN_ToJSON_CLASS = PropertiesUtils.getProperty("ignore.bean.toJson.class");
        //日期格式序列化
        BEAN_DATE_FORMAT_EXPRESSION = PropertiesUtils.getProperty("bean.date.format.expression");
        BEAN_DATE_FORMAT_CLASS = PropertiesUtils.getProperty("bean.date.format.class");
        //日期格式反序列化
        BEAN_DATE_UnFORMAT_EXPRESSION = PropertiesUtils.getProperty("bean.date.unFormat.expression");
        BEAN_DATE_UnFORMAT_CLASS = PropertiesUtils.getProperty("bean.date.unFormat.class");

        IGNORE_TABLE_PREFIX = Boolean.parseBoolean(PropertiesUtils.getProperty("ignore.Table.Prefix"));
        SUFFIX_BEAN_QUERY = PropertiesUtils.getProperty("suffix.bean.query");
        SUFFIX_BEAN_QUERY_FUZZY = PropertiesUtils.getProperty("suffix.bean.query.fuzzy");
        SUFFIX_BEAN_QUERY_TIME_START = PropertiesUtils.getProperty("suffix.bean.query.time.start");
        SUFFIX_BEAN_QUERY_TIME_END = PropertiesUtils.getProperty("suffix.bean.query.time.end");
        SUFFIX_MAPPERS= PropertiesUtils.getProperty("suffix.mapper");

        //需要忽略的属性


        PACKAGE_BASE = PropertiesUtils.getProperty("package.base");
        //po
        PACKAGE_PO = PACKAGE_BASE + "." + PropertiesUtils.getProperty("package.po");
        PACKAGE_QUERY = PACKAGE_BASE + "." + PropertiesUtils.getProperty("package.query");
        PACKAGE_MAPPERS = PACKAGE_BASE + "." + PropertiesUtils.getProperty("package.mappers");
        PACKAGE_UTILS = PACKAGE_BASE + "." + PropertiesUtils.getProperty("package.utils");
        PACKAGE_ENUMS = PACKAGE_BASE + "." + PropertiesUtils.getProperty("package.enums");


        PATH_BASE = PropertiesUtils.getProperty("path.base");
        PATH_BASE = PATH_BASE + PATH_JAVA;

        PATH_PO = PATH_BASE + "/" + PACKAGE_PO.replace(".", "/");
        PATH_QUERY = PATH_BASE + "/" + PACKAGE_QUERY.replace(".", "/");
        PATH_MAPPERS = PATH_BASE + "/" + PACKAGE_MAPPERS.replace(".", "/");
        PATH_UTILS = PATH_BASE + "/" + PACKAGE_UTILS.replace(".", "/");
        PATH_ENUMS = PATH_BASE + "/" + PACKAGE_ENUMS.replace(".", "/");

    }

    public static void main(String[] args) {
        System.out.println(PACKAGE_PO);
        System.out.println(PATH_PO);
    }
}
